<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>分店采购</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
  <link rel="stylesheet" href="../../res/css/wholesale/font.css">
  <link rel="stylesheet" href="../../res/css/wholesale/xadmin.css">
  <link rel="stylesheet" href="../../res/layui/css/layui.css">
  <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  <script type="text/javascript" src="../../res/layui/layui.js" charset="utf-8"></script>
  <script type="text/javascript" src="../../res/js/wholesale/xadmin.js"></script>
</head>
<body>
<div class="demoTable" style="margin-top: 10px ;">
    <div class="x-body">
    	<div class="layui-row">
        <div class="layui-form layui-col-md12 x-so">
          <input type="text" name="id" id="demoReload" placeholder="请输入公司名" autocomplete="off" class="layui-input">
         	 时间：
		    <input class="layui-input" placeholder="开始日" name="timaStart" id="timaStart" readonly>
          - <input class="layui-input" placeholder="截止日" name="timeEnd" id="timeEnd" readonly>
		          订单状态：
      	
	      	<div class="layui-inline">
				<select name="shzt" id="shzt" autocomplete="off" class="layui-input">
					<option></option>
					<option value="0">未提交审核</option>
					<option value="1">等待分店审核</option>
					<option value="2">等待分店总经理审核</option>
					<option value="3">等待总店审核</option>
					<option value="6">审核通过，未提交质检</option>
					<option value="5">审核通过，已提交质检</option>
					<option value="4">未通过审核</option>
				</select>
		  	</div>
		    
          <button class="layui-btn" data-type="reload" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </div>
     </div>
      
      <xblock>
        <button class="layui-btn" id="insert"><i class="layui-icon"></i>添加</button>
      </xblock>
<table class="layui-table" lay-data="{ url:'../../listenPurchase/findAll.action', page:true, id:'idTest'}" lay-filter="demo">
  <thead>
    <tr>
      <th lay-data="{field:'purchaseId', width:150,style='display:none'}">采购Id</th>
      <th lay-data="{field:'companyId', width:200, align:'center',style='display:none'}">公司Id</th>
      <th lay-data="{field:'companyName', width:200, align:'center'}">公司</th>
      <th lay-data="{field:'purchaseStringTime', width:200, align:'center'}">采购时间</th>
      <th lay-data="{field:'purchasePrice', width:200, align:'center'}">采购金额</th>
      <th lay-data="{field:'auditingStatus',width:200, align:'center',templet:'#auditingStatusType'}">审核状态</th>
      <th lay-data="{field:'suName', width:200, align:'center'}">供应商</th>
      <th lay-data="{field:'purchaseNumber', width:150, align:'center'}">采购数量</th>
      <th lay-data="{field:'purchaseExplain', width:200, align:'center'}">采购说明</th>
      <th lay-data="{field:'oper', width:120, align:'center'}">操作人</th>
     <!--  <th lay-data="{field:'isva', width:120, align:'center'}">是否有效</th>
      <th lay-data="{field:'openTime',width:120, align:'center'}">操作时间</th>
       -->
      <!-- <th lay-data="{field:'sort', width:200, align:'center'}">排序</th> -->
      <th lay-data="{ width:210,align:'center',fixed: 'right', toolbar: '#selectDemo'}">查询信息</th>
      <th lay-data="{field: 'right', width:200, align:'center', fixed: 'right', toolbar: '#barDemo'}">操作</th>
    </tr>
  </thead>
</table>
 </div>
 </div>

<script type="text/html" id="barDemo">
  {{ subMitType(d) }}
</script>
<script type="text/html" id="selectDemo">
  <a class="layui-btn layui-btn-xs" lay-event="chaDetail">查询订单详情</a>
  <a class="layui-btn layui-btn-xs" lay-event="chaAudit">查看审核详情</a>
</script>               
<script type="text/html" id="auditingStatusType">
	
     {{# if(d.auditingStatus == 1) { }}
     <div>等待分店财务审核</div>
 	 {{# } else if(d.auditingStatus == 2){ }}
     <div>分店财务已审核，等待分店总经理审核</div>
	 {{# } else if(d.auditingStatus == 5){ }}
     <div>已通过审核，已提交质检</div>
	 {{# } else if(d.auditingStatus == 6){ }}
     <div>已通过审核，未提交质检</div>
     {{# } else if(d.auditingStatus == 4){ }}
     <div>未通过审核</div>
     {{# } else if(d.auditingStatus == 3){ }}
     <div>等待总店审核</div>
	{{# } else if(d.auditingStatus == 0){ }}
     <div>未提交审核</div>
{{# }}}
 </script> 
 <!-- <a class="layui-btn layui-btn-xs" lay-event="edit">修改</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a> -->
 <script type="text/javascript">
 	function subMitType(d){
 		var  Subhtml = "";
 		if(d.auditingStatus==4){
 			Subhtml='<a class="layui-btn layui-btn-xs" lay-event="edit">修改</a><a class="layui-btn layui-btn-xs layui-btn-disabled" >提交质检</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>';
 		}else if(d.auditingStatus==6){
 			Subhtml='<a class="layui-btn layui-btn-xs layui-btn-disabled">修改</a><a class="layui-btn layui-btn-xs " lay-event="quality">提交质检</a><a class="layui-btn layui-btn-xs layui-btn-disabled">删除</a>';
 		}else if(d.auditingStatus==2||d.auditingStatus==5||d.auditingStatus==3){
 			Subhtml='<a class="layui-btn layui-btn-xs layui-btn-disabled">修改</a><a class="layui-btn layui-btn-xs layui-btn-disabled" >提交质检</a><a class="layui-btn layui-btn-xs layui-btn-disabled">删除</a>';
 		}else if(d.auditingStatus==0){
 			Subhtml='<a class="layui-btn layui-btn-xs" lay-event="edit">修改</a><a class="layui-btn layui-btn-xs " lay-event="subAudit" >提交审核</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>';
 		}else if(d.auditingStatus==1){
 			Subhtml='<a class="layui-btn layui-btn-xs layui-btn-disabled">修改</a><a class="layui-btn layui-btn-xs layui-btn-disabled" >提交质检</a><a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled">删除</a>';
 		}
 		return Subhtml;
 	}
 </script>       
<script src="https://lib.baomitu.com/jquery/1.12.4/jquery.min.js"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script type="text/javascript" src="../../res/js/purchase/purchase.js"></script>

</body>
</html>